var express = require('express');
var router = express.Router();

var userModel = require('../models/userModel');
var checkSession = require('../models/checkSession');

router.get('/', function(req, res, next) {
	var loginbean = checkSession.check(req, res);
	if(loginbean) {
		userModel.personal(req, res, loginbean);
	}
});

router.post('/changeInfo', function(req, res, next) {
	var loginbean = checkSession.check(req, res);
	if(loginbean) {
		userModel.changeInfo(req, res, loginbean);
	}
});

router.post('/collect', function(req, res, next) {
	var loginbean = checkSession.check(req, res);
	if(loginbean) {
		userModel.collect(req, res, loginbean);
	}
});

router.post('/uncollect', function(req, res, next) {
	var loginbean = checkSession.check(req, res);
	if(loginbean) {
		userModel.uncollect(req, res, loginbean);
	}
});

router.post('/userPicture', function(req, res, next) {
	var loginbean = checkSession.check(req, res);
	if(loginbean) {
		userModel.userPicture(req, res, loginbean);
	}
});

module.exports = router;
